package com.rd.student.jiaji.class1.wangyufang.day0801;

import java.util.Arrays;

public class ArrayTest {
    public static void main(String[] args) {
        int[] array = new int[]{1, 3, 5, 7, 9, 11, 13, 15, 17, 0};
        int[] array1 = Arrays.copyOf(array, 5);
        System.out.println(Arrays.toString(array1));
        int[] array2 = new int[4];
        System.arraycopy(array, 5, array2, 0, 4);
        System.out.println(Arrays.toString(array2));
        int[] array3 = new int[10];
        int[] array4 = new int[]{10};
        for (int i = 0; i < array1.length; i++) {
            System.arraycopy(array1, 0, array3, 0, 5);
        }
        System.out.println(Arrays.toString(array3));
        System.arraycopy(array4, 0, array3, 5, 1);
        System.out.println(Arrays.toString(array3));
        for (int i = 0; i < array2.length; i++) {
            System.arraycopy(array2, 0, array3, 6, 4);
        }
        System.out.println("最终结果为：" + Arrays.toString(array3));

    }
}
